package com.bwie.remote.factory;

import com.bwie.common.domain.Role;
import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.remote.UserRemote;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @className: UserRemoteFallBackFactory
 * @Description: TODO
 * @version: v1.８.0
 * @author: 汪菲阳
 * @date: 2025/10/22 9:31
 */
@Component
public class UserRemoteFallBackFactory implements FallbackFactory<UserRemote> {
    @Override
    public UserRemote create(Throwable cause) {
        return new UserRemote() {
            @Override
            public Result<User> selectUserByUserPhoneOrName(User user) {
                return Result.error("服务器繁忙，请稍候再试……");
            }

            @Override
            public Result<List<Role>> selectRoleByUserId(Integer userId) {
                return Result.error("服务器繁忙，请稍候再试……");
            }

            @Override
            public Result registerUser(User user) {
                return Result.error("服务器繁忙，请稍候再试……");
            }
        };
    }
}
